<?php

namespace app\admin\model\finance_menu;

use think\Model;


class Finance extends Model
{

    

    

    // 表名
    protected $name = 'finance';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'payment_method_text'
    ];
    

    
    public function getPaymentMethodList()
    {
        return ['现金' => __('现金'), '转账' => __('转账'), '支付宝' => __('支付宝'), '微信' => __('微信')];
    }


    public function getPaymentMethodTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['payment_method']) ? $data['payment_method'] : '');
        $list = $this->getPaymentMethodList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}
